package com.ee.bruscar;

import java.io.File;
import java.io.FileReader;
import java.net.URL;

import org.antlr.stringtemplate.StringTemplate;
import org.antlr.stringtemplate.StringTemplateGroup;
import org.antlr.stringtemplate.language.DefaultTemplateLexer;

public class GroupRunner
{

	    /* Quick and very nasty example: */
	    public static void main(String[] args)
	       throws Exception
	    {
	    	URL thisUrl = TemplateRunner.class.getResource( ".");
	    	
	    	
	    	File templateFileName = new File( thisUrl.getPath() + "/templates/classgroup.stg");
	        StringTemplateGroup group = new StringTemplateGroup(
	                new FileReader(templateFileName),
	                DefaultTemplateLexer.class    // Leave away if you want to use angle brace notation
	            );

	        StringTemplate template = group.getInstanceOf("vardef");

	        template.setAttribute("type", "Integer");
	        template.setAttribute("name", "id");

	        System.out.println(template.toString());
	    }

}
